package com.blb.demo1;

public class Demo1 {

    public static void main(String[] args) {
//        SingletonPattern bean1 = SingletonPattern.getBean();
//        SingletonPattern bean2 = SingletonPattern.getBean();
//        System.out.println(bean1);
//        System.out.println(bean1.hashCode());
//        System.out.println(bean2);
//        System.out.println(bean2.hashCode());
//
//
//        SingletonPattern2 bean3 = SingletonPattern2.getBean();
//        SingletonPattern2 bean4 = SingletonPattern2.getBean();
//        System.out.println(bean3);
//        System.out.println(bean3.hashCode());
//        System.out.println(bean4);
//        System.out.println(bean4.hashCode());

        for (int i = 0; i < 1000; i++) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    System.out.println(SingletonPattern2.getBean().hashCode());
                }
            }).start();
        }
        
        
    }
}
